<fieldset id="post_article_wrapper">
		<?php 
			$attrs = array('id' => 'post_article', 'name' => 'post_article');
			echo form_open_multipart('', $attrs);
		?>		
<div class="detail_post" id="det01">
	<h1>Lý lịch của xe</h1>
	<p>
		<label for="brandcar">Hãng xe</label>
		<select name="brandcar" id="brandcar" >
			<?php foreach($brandcarmenu as $brand): ?>
				<option value="<?php echo $brand['id']; ?>" <?php echo set_select('brandcar', $brand['id']);?>><?php echo $brand['name']; ?></option>
			<?php endforeach;?>		
		</select>
	</p>
	
	<p>
		<label for="modelcar">Mẫu xe</label>
		<select name="modelcar" id="modelcar"></select>
		<?php 
			if(isset($errors['model']))
				echo '<span class="error">' . $errors['model'] . '</span>';
		?>
		<script type="text/javascript">
    	$(window).load(function() {
			loadModel();
			$('#brandcar').change(function() {loadModel();});
    	});
		
		function loadModel() {
			$.ajax({
				url : '<?php echo base_url(); ?>customer_account/article/get_model',
				type : 'post',
				data : 'brand=' + $('#brandcar').val(),
				dateType : 'xml',
				async : false,
				error: function() {
					//alert('Error: cannot retrieve value!');
				},
				success : function(xml) {
					$('#modelcar').find('option').remove();
					$('<option value="0">Mẫu xe</option>').appendTo('#modelcar');
					$(xml).find("model").each(function() {
						var id = $(this).attr('id');
						var name = $(this).attr('name');
						$('<option value="' + id + '">' + name + '</option>').appendTo('#modelcar');
					});
				}
			});
		}
    	</script>
	</p>
	
	<p>
		<label for="yearmade">Năm sản xuất</label>
		<select name="yearmade" id="yearmade" >
		<?php foreach($years as $year): ?>
			<option value="<?php echo $year; ?>" <?php echo set_select('yearmade', $year); ?>><?php echo $year; ?></option>
		<?php endforeach; ?>
		</select>
	</p>
	
	<p>
		<label for="country">Quốc gia</label>
		<select name="country" id="country">
			<?php foreach($countrymenu as $country): ?>
				<option value="<?php echo $country->id; ?>" <?php echo set_select('country', $country->id);?>><?php echo $country->name; ?></option>
			<?php endforeach;?>		
		</select>
	</p>
	<p>
		<label for="typecar">Dòng xe</label>
		<select name="typecar" id="typecar">
			<option value="1">Gia đình</option>
			<option value="2">Xe tải</option>
		</select>
	</p>
	
	<p>
		<label for="price">Giá tiền</label>
		<input type="text" name="price" id="price" title="Vui lòng nhập số" value="<?php echo set_value('price'); ?>"/>
		<input name="currency" type="radio" value="VND" 
			<?php echo set_radio('currency', 'VND', true); ?> /> triệu VND
		<input name="currency" type="radio" value="USD" 
			<?php echo set_radio('currency', 'USD'); ?> /> ngàn USD
		<?php 
			if(isset($errors['price']))
				echo '<span class="error">' . $errors['price'] . '</span>';
		?>
	</p>
</div>
<div class="detail_post" id="det02">	
	<h1>Thành phần của xe</h1>
	<p>
		<label for="carimage">Ảnh xe</label>
		<input type="file" name="carimage" id="carimage" />
		<?php 
			if(isset($errors['carimage']))
				echo '<span class="error">' . $errors['carimage'] . '</span>';
		?>
	</p>
	<p>
		<label for="gearbox">Loại hộp số</label>
		<select name="gearbox" id="gearbox">
			<option value="1">Số sàn</option>
			<option value="2">Số tự động</option>
		</select>
	</p>
	<p>
		<label for="exterior">Ngoại thất</label>
		<input name="exterior" id="exterior" type="text" value="<?php echo set_value('exterior'); ?>" />
		<?php 
			if(isset($errors['exterior']))
				echo '<span class="error">' . $errors['exterior'] . '</span>';
		?>
	</p>
	
	<p>
		<label for="interior">Nội thất</label>
		<input name="interior" id="interior" type="text" value="<?php echo set_value('interior'); ?>" />
		<?php 
			if(isset($errors['interior']))
				echo '<span class="error">' . $errors['interior'] . '</span>';
		?>
	</p>
	<p>
		<label for="seat">Số chỗ ngồi</label>
		<input name="seat" id="seat" type="text" value="<?php echo set_value('seat'); ?>" />
		<?php 
			if(isset($errors['seat']))
				echo '<span class="error">' . $errors['seat'] . '</span>';
		?>
	</p>
	<p>
		<label for="fueltype">Loại động cơ</label>
		<select name="fueltype" id="fueltype">
			<?php foreach($fuelmenu as $fuel): ?>
				<option value="<?php echo $fuel->id; ?>" <?php echo set_select('fueltype', $fuel->id);?>><?php echo $fuel->name; ?></option>
			<?php endforeach;?>	
		</select>

	</p>
		<p>
			<label for="liter_per_km">Mức tiêu hao</label>
			<input type="text" name="liter_per_km" id="liter_per_km" value="<?php echo set_value('liter_per_km'); ?>" /> <span> lít/KM</span>
			<?php 
			if(isset($errors['liter_per_km']))
				echo '<span class="error">' . $errors['liter_per_km'] . '</span>';
			?>
		</p>
</div>
<div class="detail_post" id="det03">
	<p>
		<label for="article_title" style="width:500px">Tiêu đề mẫu tin</label> <br/>
		<input type="text" name="article_title" id="article_title" value="<?php echo set_value('article_title'); ?>" size="40" /> 
		<?php 
			if(isset($errors['article_title']))
				echo '<span class="error">' . $errors['article_title'] . '</span>';
		?>
	</p>
	<p>
		<label style="width:500px;">Mô tả khái quát</label>
		<textarea name="description"><?php echo set_value('description'); ?></textarea>
		<?php 
			if(isset($errors['description']))
				echo '<span class="error">' . $errors['description'] . '</span>';
		?>
	</p>
	<p>
		<input type="submit" name="post_article_button" id="post_article_button" value="Gửi" />
	</p>
</div>	
	</form>
</fieldset>